package com.eos.control.action.activity;

import com.eos.business.service.SysActivityBusinessService;
import com.eos.common.tool.ObjectUtils;
import com.eos.control.action.base.AbstractBaseAction;
import com.eos.orm.mybatis.model.SysActivty;
import com.eos.orm.mybatis.model.SysUser;

public class UpdateActivityAction extends AbstractBaseAction {
	private static final long serialVersionUID = 862758422359839200L;
	private Integer activtyId;
	private String activtyNumber;
	private String activtyName;
	private Integer customerId;
	private String startTime;
	private String endTime;
	private String brokerageRate;
	private String activtyDesc;

	public void setActivtyId(Integer activtyId) {
		this.activtyId = activtyId;
	}

	public void setActivtyNumber(String activtyNumber) {
		this.activtyNumber = activtyNumber;
	}

	public void setActivtyName(String activtyName) {
		this.activtyName = activtyName;
	}

	public void setCustomerId(Integer customerId) {
		this.customerId = customerId;
	}

	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	public void setBrokerageRate(String brokerageRate) {
		this.brokerageRate = brokerageRate;
	}

	public void setActivtyDesc(String activtyDesc) {
		this.activtyDesc = activtyDesc;
	}

	@Override
	public String execute() {
		try {
			SysUser user = (SysUser) getSession().getAttribute("SysUser");
			String userId = user.getId() + "";
			SysActivityBusinessService sabs = new SysActivityBusinessService();
			SysActivty activity = new SysActivty();
			activity.setActivtyDesc(activtyDesc);
			activity.setActivtyName(activtyName);
			activity.setActivtyNumber(activtyNumber);
			activity.setBrokerageRate(brokerageRate);
			activity.setCustomerId(customerId);
			activity.setEndTime(endTime);
			activity.setId(activtyId);
			activity.setUpdateUserId(userId);
			activity.setStartTime(startTime);
			activity.setUpdateUserId(userId);
			activity.setModifyTime(ObjectUtils.formatDate(null, "yyyy-MM-dd HH:mm:ss"));
			String exeStatus = sabs.updateSysActivtyPKSelective(activity);
			if("SUCCESS".equals(exeStatus)){
				statusCode = "200";
				message = "修改活动信息成功!";
			}else{
				statusCode = "300";
				message = "系统繁忙, 修改活动信息失败!";
			}
		} catch (Exception e) {
			e.printStackTrace();
			statusCode = "300";
			message = "系统异常,修改活动信息失败!";
		}
		return SUCCESS;
	}
}
